<extend name="Public/base" />

<!-- 桌面商家新增和编辑页面 -->
<block name="body">
	<div class="main-title">
		<h2>{$data['id']?'编辑':'新增'}买送商品规则</h2>
	</div>

  <form action="{:U('update')}" enctype="application/x-www-form-urlencoded" method="POST" class="form-horizontal">
    <div class="item-field"><h4 class="title"><i>1</i>主商品信息</h4></div>
    <div class="form-item">
      <label for="auth-title" class="item-label">活动的主商品</label>
      <div class="controls">
        {:hook('itemSel', array('name' => 'item_id', 'items' => $data['item_id'], 'type' => 'radio'))}
      </div>
    </div>
    <div class="form-item">
      <label for="auth-title" class="item-label">最低购买数量 <span class="check-tips">（达到该数量则赠送）</span></label>
      <div class="controls">
        <input type="text" name="min_num" class="text input-xmini text-center" value="{$data.min_num|default=1}" placeholder=""/> 件
      </div>
    </div>
    <div class="item-field"><h4 class="title"><i>2</i>赠品</h4></div>
    <div class="form-item">
      <div class="controls">
        {:hook('itemSel', array('name' => 'send_item_id', 'items' => $data['send_item'], 'tpl' => 'setNumber'))}
      </div>
    </div>
    
    <div class="item-field"><h4 class="title"><i>3</i>活动设置</h4></div>
    
    <div class="form-item">
      <label for="auth-title" class="item-label">活动时间<span class="check-tips">（截止所选当日23时59分59秒）</span></label>
      <div class="controls">
        <input type="text" name="start_time" class="text input-small date_select" value="{:time_format($data['start_time'], 'Y-m-d')}" placeholder="开始时间"/>
          至
        <input type="text" name="expire_time" class="text input-small date_select" value="{:$data['expire_time'] ? time_format($data['expire_time'], 'Y-m-d') : null}" placeholder="结束时间"/>
      </div>
    </div>
    <div class="form-item">
      <input type="hidden" name="id" value="{$data.id}" />
      <button type="submit" class="btn submit-btn ajax-post" target-form="form-horizontal">确 定</button>
      <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
    </div>
  </form>
<block>

<block name="script">
  <script language="javascript" type="text/javascript" src="__PUBLIC__/Admin/js/My97Date/WdatePicker.js"></script>
  <script type="text/javascript" charset="utf-8">
    $(function(){
      //导航高亮
      highlight_subnav('{:U("index")}');
      //时间选择
      $('.date_select').focus(function(){
        WdatePicker({skin: 'twoer', dateFmt: 'yyyy-MM-dd'});
      });
    });
  </script>
</block>
